#!/usr/bin/env python3
# coding: utf-8
# Copyright (c) 2025 Huawei Technologies Co., Ltd.
# This file is a part of the CANN Open Software.
# Licensed under CANN Open Software License Agreement Version 1.0 (the "License").
# Please refer to the License for details. You may not use this file except in compliance with the License.
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
# See LICENSE in the root of the software repository for the full text of the License.
# ======================================================================================================================
api: pytorch
api_type: ascend_function_grouped_matmul
aclnn_api_type: aclnn_grouped_matmul
version: v2.1
name: grouped.matmul
aclnn_name: GroupedMatmulV5
generate: ascend_generate_grouped_matmul
dtype_numbers: 20
extra_numbers: 0
standard:
  acc:
    cv_fused_double_benchmark
    # type 选择高精度/高性能/Vector融合算子标准类型，默认为高精度 
    # 高精度:high_precision;高性能:high_performance;Vector融合算子:vector_fused
      # type: vector_fused
inputs:
  - name: x
    type: tensors
    tuple_numbers:
      values: [1]
    required: true
    dtypes:
      values: [ int8 ]
    ranges:
      valid:
        values: [ [ -5, 5 ] ]
      invalid:
        values: []
    shapes:
      dim_numbers:
        values: [2]
      dim_values:
        values: [[ 1,7168 ]]
  - name: weight
    type: tensors
    tuple_numbers:
      values: [1]
    required: true
    dtypes:
      values: [ int8 ]
    ranges:
      valid:
        values: [ [ -5, 5 ] ]
      invalid:
        values: []
    shapes:
      dim_numbers:
        values: [3]
      dim_values:
        values: [[ 1,7168 ]]
  - name: scaleOptional
    type: tensors
    tuple_numbers:
      values: [1]
    required: true
    dtypes:
      values: [ fp32 ]
    ranges:
      valid:
        values: [ [ -5, 5 ] ]
      invalid:
        values: []
    shapes:
      dim_numbers:
        values: [2]
      dim_values:
        values: [[ 1,7168 ]]
  - name: perTokenScaleOptional
    type: tensors
    tuple_numbers:
      values: [1]
    required: false
    dtypes:
      values: [ fp32 ]
    ranges:
      valid:
        values: [ [ -5, 5 ] ]
      invalid:
        values: []
    shapes:
      dim_numbers:
        values: [1]
      dim_values:
        values: [[ 1,7168 ]]
  - name: groupList
    type: tensor
    required: true
    dtypes:
      values: [ int64 ]
    ranges:
      valid:
        values: [ [ 1, 100 ] ]
      invalid:
        values: []
    shapes:
      dim_numbers:
        values: [1]
      dim_values:
        values: [[ 1,128 ]]
  - name: splitItem
    type: attr
    required: true
    dtypes:
      values: [ int ]
    ranges:
      valid:
        values: [ [2] ]
      invalid:
        values: [2]
  - name: groupType
    type: attr
    required: true
    dtypes:
      values: [ int ]
    ranges:
      valid:
        values: [0]
      invalid:
        values: [0]
  - name: groupListType
    type: attr
    required: true
    dtypes:
      values: [ int ]
    ranges:
      valid:
        values: [ [0] ]
      invalid:
        values: [0]
  - name: actType
    type: attr
    required: true
    dtypes:
      values: [ int ]
    ranges:
      valid:
        values: [ [0,1,2,4,5] ]
      invalid:
        values: [[0,1,2,4,5]]
  - name: tuningConfigOptional
    type: attr_tuple
    required: true
    dtypes:
      values: [ int ]
    tuple_numbers:
      values: [ 1 ]
    ranges:
      valid:
        values: [ [1, 512] ]  
      invalid:
        values: [ ]
  - name: wformat
    type: attr
    required: false
    dtypes:
      values: [ string ]
    ranges:
      valid:
        values: [ "FRACTAL_NZ" ]
  - name: outType
    type: attr
    required: true
    dtypes:
      values: [ string ]
    ranges:
      valid:
        values: [""]
      invalid:
        values: [""]
